package com.example.aerospacemanagementsystem.controller.attendance;

import com.example.aerospacemanagementsystem.entity.attendance.Cancellation;

import com.example.aerospacemanagementsystem.service.attendanceService.CancellationService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
/**
 * @author 李明国
 */
@Api(tags = "销假")
@RestController
@CrossOrigin
@RequestMapping("/cancellation")
public class CancellationController {
    @Autowired
    private CancellationService cancellationService;
    //添加销假
    @PostMapping
    public int add(@RequestBody Cancellation cancellation){
        return cancellationService.add(cancellation);
    }
    //删除销假
    @DeleteMapping
    public int delete(Cancellation cancellation){
        return cancellationService.delete(cancellation);
    }
    //修改销假
    @PutMapping
    public int update(@RequestBody Cancellation cancellation){ return cancellationService.update(cancellation);
    }
    //获取销假
    @GetMapping("/getAll")
    public List<Cancellation> getAllCity(Cancellation cancellation) {
        List<Cancellation> list = cancellationService.getAllCancellation(cancellation);
        return list;
    }
}
